006 basic controls
现在让我们继续看看一些基本的控件。
Now let's go ahead and start looking at some basic controls.
我要继续打开我们的主屏幕,这些东西很漂亮,你知道我要删除它们只是为了让它们不妨碍我,但我真的很喜欢看它们,而且没有太多有趣的东西屏幕上正在发生,所以让我们继续将它们留在那里进行静态分析。
I'm going to go ahead and open up our main screen here and these things are pretty you know what I was going to delete them just to get them out of my way but I really kind of like looking at them and there's not much interesting going on on the screen so let's just go ahead and leave them there for a statics.
无论如何,我将来到这里讨论对象,让我们首先使用我们的按钮。
Anyway I'm going to come up here to objects and let's go with first and foremost our push button.
我们有一个瞬时按钮,我在上一节中简要解释了这一点,其中我们讨论了当您的手指放在按钮上时,当您的手指离开按钮时,一旦您按下按钮,它就会断电,保持的位会断电。按下按钮,它会保持按下状态,并保持该位通电。
We have a momentary push button and I explain this briefly in the last section where we were talking about seemore momentary energises a bit while your fingers on the button and the second your finger comes off it de-energize the bit maintained will once you push that button down it will stay down and it will keep that bit energized.
好吧,我们真的不想依赖 HDMI 来控制我们的位和 PLCC,我们很高兴让它偶尔向我们发送信号,但我真的不希望它为我保留一点,所以我知道很多的程序员使用这个。
Well we don't really want to depend on our HDMI to control our bits and our PLCC we're happy to let it send us an occasional signal but I don't really want it to maintain a bit for me so I know a lot of programmers use this.
我不是他们中的一员。
I'm not one of them.
同样,我们有闩锁,我们有多状态联锁来调节各种不同的按钮。
Same thing we've got latchet we've got multi-state Interlok to ramp all kinds of different buttons.
但实际上,对于我一直教你在人们看到的 PRC 中编写的那种逻辑,瞬时按钮是你真正需要的唯一按钮。
But really for the kind of logic that I've been teaching you to write in people see one in PRC to momentary is the only button you're ever going to really need.
这并不意味着您的所有按钮都将是像这样无聊的蓝色方形按钮。
That doesn't mean all your buttons are going to be boring square blue buttons like this.
您可以通过多种不同的方式重新设置这些按钮的样式。
You can restyle these buttons a lot of different ways.
你想要它是一个圆你想要它是一个椭圆吗?
Do you want it to be a circle do you want it to be an ellipse.
您希望它是透明的或具有纯色背景。
You want it to be transparent or have a solid background.
图案呢。
What about pattern.
如果你愿意的话,你可以用小盒子制作这个东西。
You could make this thing up out of little small boxes if you wanted to.
好吧,您可以做各种不同的有趣的事情来重新设计按钮。
OK there's all kinds of different fine happy things you can do to restyle your buttons.
你可以让它们看起来像你想要的任何东西,但就它们的工作方式而言。
You can make them look like whatever you want but as far as how they work.
我的建议是使用瞬时按钮。
My recommendation is use momentary buttons.
因此,让我们先在屏幕上放置几个控件。
So let's go ahead and start by dropping a couple of controls on the screen.
我将在此处放置一个瞬时按钮,您可以看到它看起来就像我们的导航按钮,但是当我们单击此处窗口顶部的导航按钮时,它会显示“转到显示按钮属性”。
I'm going to drop a momentary push button right here and you can see it looks just like our navigation button but when we click on our navigation button at the top of the window here it says go to display button properties.
当我双击它时,它会显示瞬时按钮属性。
When I double click on this it says momentary push button properties.
因此,尽管它们看起来很相似,但它们是两个不同的东西。
So these are two different things even though they come out looking alike.
话虽如此,当您设计自己的样式时,我建议您让它们看起来有点不同,并根据它们的功能和控制内容对它们进行分类。
That being said when you're styling yours I would recommend you make them look a little bit different and classify them based on their functionality and what they're controlling.
因此,我们想要为按钮做的第一件事是将其连接到我们想要将其连接到我们的一个标签的东西。
So the first thing we want to do for a button is connected to something we want to connect it to one of our tags.
这个按钮同时具有一个值和一个指示器,因此它可以指示该位处于什么状态或不同的投标人。
And this button has both a value and an indicator so it can indicate what state the bit is in or a different bidders.
因此,如果我们想使用正在运行的系统,我们可以将其作为一个启动按钮,它还可以向我们显示系统的状态,无论它是否正在运行。
And so if we wanted to use for instance the system running we could have this be a start button which could also show us the status of the system whether it's running or not.
现在这可能会令人困惑,尤其是如果您有一个关闭按钮,它与最终看起来像的按钮具有相同的功能。
Now that could be confusing especially if you have an off button which does the same thing as kind of your buttons that are going to end up looking like.
但你知道这取决于你想如何规划自己的年龄消亡。
But you know that's up to how you want to style your own age demise.
但是,让我们假设这次我们甚至不会担心我们只是要设置一个值的指标。
But let's pretend this time we're not even going to worry about the indicator we're just going to set a value.
因此,我将单击我的标签,然后进入我在其中创建标签的 PLCC 三文件夹。
So I'm going to click on my tag and let's go into my PLCC three folder where I was creating my tags.
尽管我可以直接通过欧佩克服务器解决这些问题,但这并不重要。
Even though I could address them directly through the OPEC servers it really doesn't matter.
但我将继续使用此启动按钮标签并单击“确定”。
But I'm just going to go ahead and take this start push button tag and hit OK.
就像我已经将此标签分配给某些东西一样。
So just like that I've assigned to this tag to something.
现在我在按钮状态上有两种状态。
Now I've got two states on a pushbutton state.
零是我没有按下按钮时的状态。
Zero is when I'm not pushing the button state.
一种是当我按下按钮时。
One is when I am pushing the button.
这些按钮的作用是允许您在这些按钮上设置不同的样式。
So what these do is allow you to set different styles on these buttons.
例如,我将把背景颜色设置为绿色,因为这是一个开始按钮。
So for instance I'm going to set the background color to green because this is a start button.
然后对于状态一,我将把这个按钮更改为灰色。
And then for state one I'm going to change this button gray.
我这样做的唯一原因是向操作员表明,是的,您确实成功按下了按钮。
And the only reason I'm doing that is to show the operator that yes you did successfully push the button.
你不只是触摸了屏幕,而且你知道触摸到了错误的地方或类似的地方。
You didn't just touch the screen and you know touch it on the wrong place or something like that.
我要在这里给它贴上一个标签。
And I'm going to give it a label here.
只需调用它开始,我就会制作该字体。
Just call it start and I will make that font.
让我们将其设置为 12 号,然后继续将其设置为粗体。
Let's make it a size 12 and let's go ahead and make it bold.
所以我要在这里点击“申请”,确定。
So I'm going to hit apply here OK.
只是为了看看这个东西是什么样子。
And just to see what this thing looks like.
我将继续并单击应用程序上的“测试”,选择“是”并让其运行。
I'll go ahead and click test on the application select Yes and let this thing run.
我只想向您展示按下按钮时的状态变化。
And I just want to show you the state change when I push the button.
说我能知道我在说什么吗?
Say can I know what I'm talking about.
你可能已经这样做了。
That you probably already do.
如果有助于你学习的话,我不介意有点多余。
And I don't mind being a little redundant if it helps you learn.
那么让我们继续进行练习。
So let's go ahead and go through the exercise.
这是我们的界面,当我单击按钮时,您会看到它变成灰色,并且我的标签消失,因此每当操作员触摸它时,都会给他一个很好的指示,表明您确实只是触摸了该按钮并将该信号发送到 PRC。
Here's our interface and when I click the button you see it turns gray and my label disappears so that whenever the operator touches it gives him a good indication that yes you really did just touch this button and send that signal into the PRC.
就这样了。
So that's it for there.
让我离开这个并回到我们的主显示器,就像我们想要将数字信号发送到我们的中华人民共和国一样。
Let me get out of that and go back into our main display like we want to send in digital signals into our PRC.
我们想要发送到 APRC 模拟信号中的其他内容是什么?
What's the other thing that we want to send into our APRC analog signals.
我们希望向其发送数字而不仅仅是位。
We want to send it numbers not just bits.
因此,让我们回到这里来反对,然后让我们讨论数字和字符串。
So let's come back up here to object and let's go to numeric and string.
我们有数字显示,然后我们也有数字输入,我们有字符串显示,我们也有字符串输入。
We've got numeric display and then we've also got numeric inputs we've got string displays and we've got string inputs as well.
因此,让我们继续启用此数字输入并双击它。
So let's go ahead and take this numeric input enable and double click on that.
让我们将它与某些东西联系起来。
Let's connect it to something.
所以我们要把它连接到标签 H.O.
So we're going to connect it to the tag H.O.
HSV 一并点击“确定”。
HSV one and hit OK.
这将使我们能够设置该标签。
And that's going to give us the ability to set that tag.
我们还可以在这里做的其他事情是我们还可以设置最小值和最大值。
Something else we can do down here is we can also set a minimum and maximum.
所以我不会在那里设置它,因为如果我们要将它连接到一个标签,那会更多,而不是我要进入 Gnumeric,我将在这里设置最小值和最大值,范围是将从 0 到 2,我可以选择我想要的小数点类型。
So I'm not going to set that there because that would be more if we were going to connect it to a tag rather I'm going to come into Gnumeric and I'm going to set minimum and maximum values here and the range is going to be from 0 to 2 and I can select what kind of decimal points I want.
在这种情况下,它将是一个小数点后为零的固定位置。
In this case it's going to be a fixed position with zero decimals.
这对我们和品牌来说应该是完美的。
That should be perfect for us and for the label.
我将仅使用标签本身创建标签。
I'm going to just create the label using the tag itself.
因此,让我们单击“插入变量数字”,我将浏览到此处的标签,然后单击“确定”,然后单击“确定”,然后应用它并单击“确定”。
So let's click on insert variable numeric and I'm going to browse to my tag right over here hit OK and OK and I'll go ahead and apply that and hit OK.
然后你可以看到我有五个不同的地方。
And then you can see I've got five different places.
我不需要五个地方。
I don't need five places.
让我们回到标签,我将双击该标签。
So let's come back in here to the label and I'm going to double click on this tag.
关于位数,让我们继续将其设置为 1,小数点后为零,在左侧填充 9 个英雄即可。
And on the number of digits let's go ahead and set that to 1 with zero decimal places filling the left with nine hero OK on that.
然后我还将把这个尺寸增加到 14 之类的。
And then I'm also going to bump that size up to something like 14.
点击应用。
Hit apply.
现在这件事看起来明智多了。
Now that thing looks a lot more sensible.
这就是设置数字显示的方法。
That's how you can set up a numeric display.
你知道这里的一切看起来都有点块状。
And you know everything's kind of looking blocky here.
那么让我们回去说一下你知道的。
So let's go back in and say you know what.
我不希望我的数字输入被提高。
I don't want my numeric inputs to be raised.
让我们继续将它们设为 9。
Let's go ahead and make them 9.
所以它们不会有任何边框,我们会给它们一个坚实的背面样式。
So they're not going to have any kind of border and we'll give them a solid back style.
形状上没有图案。
No pattern on the shape.
我们将继续将其保留为矩形。
We'll go ahead and leave that as a rectangle.
但背景颜色。
But the back ground color.
让我们继续在这里应用类似深绿色头发的东西。
Let's go ahead and make that something like a dark green hair apply here.
好的。
OK.
好吧。
And all right.
所以现在看起来有点不同。
So now this looks a little bit different.
因此,我们的导航按钮看起来并不都与其他按钮相同。
And just so our navigation buttons don't all look the same as everything else.
我将继续将其更改为圆圈。
I'll go ahead and change that to a circle.
好的。
OK.
所以你现在知道我可以稍微玩一下这些东西,是的,我可以比仅仅使用不同颜色的正方形和矩形更有创意。
So you know now I can play with these things a little bit and yes I could be more creative than just squares and rectangles with a different color.
但现在的重点并不是真正的艺术性和美学。
But the point now isn't really artistry and aesthetics.
现在的重点是如何实际创建一些输入。
The point now is how to actually create some inputs.
现在我有了数字输入。
So now I've got a digital input.
我有一个数字输入,有了这两件事,您的操作员就可以将他需要的所有内容发送到中华人民共和国。
I've got a numeric input and with those two things your operator is really able to send everything that he needs into the PRC.
是否还有其他我们可以使用的对象?
Are there other objects appear that we can use.
实际上没有很多其他东西可以输入信息。
There aren't really a lot of other things to input information.
还有很多东西可以显示信息,但就输入“是”而言,还有一些其他控件,但实际上 90%以上的时间这两个是您将要使用并且真正应该使用的最佳实践。
There are a lot more things to display information but as far as inputting Yes there are a few other controls but really 90 plus percent of the time these are the two that you are going to be and really should be using is best practice.
这就是控件。
That's it for controls.
下次见。
I'll see you next time.
我们将开始观看一些展示。
And we'll start looking at some displays.
干杯
Cheers